﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="ChatBox.Login" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Chatbox à la J&D</title>
    <script lang="javascript">
        function SetLabelToCurrentRecepiant()
        {
            var textbox = document.getElementById("<%=SelectedName.ClientID %>");            
            var name =document.getElementById("<%=LBContacts.ClientID %>")

            textbox.value = name[name.selectedIndex].value;
            CheckSelectedName();
        }

        function CheckSelectedName() 
        {
            var textbox = document.getElementById("<%=SelectedName.ClientID %>"); 
            if (textbox.value != "#")
            {
                document.getElementById("<%=TextChatBox.ClientID %>").disabled = false;
            }
        }
    </script>
</head>
<body onload="CheckSelectedName()">
    <form id="Login" runat="server">
    <div>
        <%if (Session["xmppClient"] == null){ %>
        <table>
            <tr><td>Naam:</td><td><asp:TextBox ID="TbNaam" runat="server"></asp:TextBox></td></tr>
            <tr><td>Wachtwoord:</td><td><asp:TextBox ID="tbPassword" runat="server" TextMode="Password"></asp:TextBox></td></tr>
            <tr><td><asp:Button ID="LoginButton" runat="server" Text="Login!" OnClick="LoginButton_Click" /></td><td></td></tr>
        </table>
        <% }
           else
           { %>
            
            <h2>Welkom in de chatbox</h2>
        <hr />

        <table>
            <tr><td><h4>Online Contacten:</h4></td><td><h4>Chatbox</h4></td></tr>
            <tr><td> 
                <asp:ListBox ID="LBContacts" runat="server" Rows="25" Width="300px"></asp:ListBox></td><td style="border-left: 5px solid #CCCC00"><asp:TextBox ID="ChatBox" runat="server" TextMode="MultiLine"  Columns="85" Rows="25" ForeColor="Gray" /></td></tr>
            <tr><td><asp:Button ID="RefreshButton" runat="server" Text="Refresh" OnClick="RefreshButton_Click" /></td><td></td></tr>
            <tr><td>Spreek met <asp:Textbox ID="SelectedName" runat="server" value="#" Enabled="false" Height="40px" Width="230px" /></td><td><asp:TextBox ID="TextChatBox" Enabled="false" runat="server" Height="40px" Width="600px" />
                <asp:Button ID="SendChat" Text="Verzend" runat="server" /></td></tr>
        </table>
         <hr />
        <asp:Button ID="LogoutButton" runat="server" Text="Logout!" OnClick="LogoutButton_Click" />

        <% } %>

       
    </div>
    </form>
</body>
</html>
